// Binary Search Implmentation
// psuedo-code
// if(middle == desired_element)
//	"Done!"
// if(middle < desired_element)
//	Pop elements after middle
//	Search from the start of the array
// if(middle > desired_element)
//	Pop element's leading up to the middle
//	Search from the middle(and remove the middle)
// if(current_element == desired_element)
//	exit!
//	"Succesful!"
// if(desired_element != found)
//	exit!
//	"Not Succesful"
#include <stdio.h>
#include <stdlib.h>

//WELL THE CODE MIGHT BE VALID, BUT SINCE I HAVE FORGOTTEN HOW TO DECLARE  APROPER ARRAY AND KNOW LITTLE ABOUT MALLOC I CANT TEST
int binary_search(int array[1024],int desired_element)
{

// Variable Declaration
int array_size = sizeof(array) / sizeof(int);
int current_element = 0;
int middle = array_size / 2 - 1;
int middle_checked = 0;

while(current_element != array_size)
{
if(array[middle] == desired_element)
{
printf("Desired element is at %d", &middle);
break;
}

if(desired_element > middle)
	{
	current_element = middle + 1;
	while(1)
	{
	if(current_element == array_size)
	{
	printf("Element does not Exist");
	break;
	}

	if(array[current_element] == desired_element)
	{
	printf("Element found at %d", &current_element);
	return current_element;
	break;
	}
	}
	}

if(desired_element < middle)
{
	current_element = 0;
	while(1)
	{
	if(current_element == middle)
	{
	printf("Element not found");
	break;
	}

	if(array[current_element] == desired_element)
	{
	printf("Element found at %d", &current_element);
	return current_element;
	break;
	}

	}


}

}

}

int main()
{

return 0;
}
